Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-object-hash

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-object-hash

Node.js object hash library with properties/arrays sorting to provide constant hashes

  • 2.3.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
664K
decreased by-7.88%
Maintainers
1
Weekly downloads
 
Created

What is node-object-hash?

The node-object-hash package is a utility for creating consistent hash values from JavaScript objects. It is useful for tasks such as caching, object comparison, and ensuring data integrity.

What are node-object-hash's main functionalities?

Hashing Objects

This feature allows you to create a hash from a JavaScript object. The hash can be used to uniquely identify the object.

const objectHash = require('node-object-hash');
const hasher = objectHash();
const obj = { name: 'John', age: 30 };
const hash = hasher.hash(obj);
console.log(hash);

Custom Hashing Options

This feature allows you to customize the hashing process by specifying options such as coercion and the hashing algorithm.

const objectHash = require('node-object-hash');
const hasher = objectHash({ coerce: true, alg: 'sha256' });
const obj = { name: 'John', age: 30 };
const hash = hasher.hash(obj);
console.log(hash);

Hashing Arrays

This feature allows you to create a hash from an array, ensuring that the array's contents are uniquely identified.

const objectHash = require('node-object-hash');
const hasher = objectHash();
const arr = [1, 2, 3, 4];
const hash = hasher.hash(arr);
console.log(hash);

Other packages similar to node-object-hash

Keywords

FAQs

Package last updated on 14 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc